package singleton;

public class Well {
    /**
     * 懒汉式单例
     * 优点:不会有资源的浪费.
     * 缺点:需要处理线程安全问题.
     */
    private static Well well;
    private Well(){
        /**
         * 构造器私有化,这样外界没有办法直接调用构造器来创建该类的实例
         */
        System.out.println("Well's constructor()");
    }

    public synchronized static Well getInstance(){
        if(well == null){
            well = new Well();
        }
        return null;
    }
}
